set(CUR_LIB MathFunctions)

add_library(${CUR_LIB}
    MathFunctions.h
    MathFunctions.cxx
)

target_include_directories(${CUR_LIB}
    INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

option(USE_MYMATH "Use tutorial provided math implementation" ON)
message(STATUS  "USE_MYMATH       ${USE_MYMATH}")

if(USE_MYMATH)
    add_library(SqrtLibrary STATIC
                mysqrt.h
                mysqrt.cxx
                )
    target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags)
    target_link_libraries(${CUR_LIB} PRIVATE SqrtLibrary)
    target_compile_definitions(${CUR_LIB} PRIVATE USE_MYMATH)
endif()

target_link_libraries(${CUR_LIB} PUBLIC tutorial_compiler_flags)

# 当前正在处理的源目录
message(STATUS  "CMAKE_CURRENT_SOURCE_DIR       ${CMAKE_CURRENT_SOURCE_DIR}")